﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineMovieTicket.Services.IServices;
using OnlineMovieTicket.Services.Services;
using OnlineMovieTicket.Model;

namespace OnlineMovieTicket.WebForms.UserControl
{
    public partial class ShowImage1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Int32 movieCode;
            if (Request.QueryString["id"] != null)
                movieCode = Convert.ToInt32(Request.QueryString["id"]);
            else
                throw new ArgumentException("No parameter specified");           


            IMoviesService movieSrv = new MoviesService();
            Model.Movies movie = movieSrv.GetMovie(movieCode);

            Response.ContentType = "imag/jpg";
            Response.BinaryWrite(movie.Image);
        }
    }
}